<?php
/**
 * project root path
 */
define('PATH_ROOT', dirname(__FILE__));
/**
 * common class path
 */
define('PATH_CLASS', PATH_ROOT.'/class');

/**
 * current domain sub class path
 */
define('PATH_DOMAIN', PATH_ROOT.'/domain/'.strtolower($_SERVER['HTTP_HOST']));


require PATH_CLASS . '/WebBase.php';

$class = 'DomainBase';
if(preg_match('/\w+/', $_GET['c']))
{
	$class = $_GET['c'];
}


$lang = 'zh_CN';
if(preg_match('/\w+/', $_COOKIE['lang']))
{
	$lang = $_COOKIE['lang'];
}

/**
 * template path by language
 */
define('PATH_TPL', PATH_DOMAIN.'/'.$lang);

/**
 * obj response
 */
global $response;
$response = new stdClass;

require PATH_DOMAIN . "/$class.php";

$obj = new $class();
$obj->setLang(require PATH_TPL.'/lang.php');


$title = $obj->getSubTitle();
if($title)
{
	$title .= ' - ';
}
$title .= $obj->getTitle();

$response->title = WebBase::xmlEncode($str);

$str = $obj->buildHead();

$str .= $obj->buildTop();
$str .= $obj->buildBody();
$str .= $obj->buildBottom();

echo $str;
